<template>
  <div id="OrdersTitle">
    <v-details
      :inputConfig="inputConfig"
      :detailData="inputData"
      :rules="rules"
      ref="input"
      @changeData="changeData"
    ></v-details>
  </div>
</template>

<script>
import details from 'commons/Detail'
import baseMixin from "@/mixins/BaseMixin";

export default {
  props: {
    inputData: {
      type: Object,
    }
  },
  mixins: [baseMixin],
  name: "OrdersTitle",
  data () {
    return {
      addflag: false,
    }
  },
  computed: {
    inputConfig () {
      return [
        [
          {
            type: "input",
            label: this.$t('manage.printername'),
            props: "printername",
            disabled: this.addflag
          },
          {
            type: "checkbox",
            label: this.$t('manage.defaultprinterflag'),
            props: "defaultprinterflag",
          },
        ],
        [
          {
            type: "input",
            label: this.$t('common.desc'),
            props: "descr",
          },
          {
            type: "checkbox",
            label: this.$t('manage.isemailprinter'),
            props: "isemailprinter",
          },
        ],
      ]
    },
    rules () {
      return {

      }
    }
  }
  ,
  methods: {
    changeData (data) {
      this.$parent.$parent.saveStatus = false;
    }
  },
  mounted () {
    if (Object.keys(this.$store.state.skip).length !== 0) {
      let data = this.$store.state.skip;
      if (data.newFlag) {
        this.addflag = false;
      } else {
        this.addflag = true;
      }
    } else if (this.$store.state.newFlag) {
      this.addflag = false;
    } else {
      this.addflag = true;
    }
  },
  watch: {},
  components: {
    'v-details': details
  }
}
</script>

<style scoped>
</style>
